import type { WritableComputedRef, ComputedRef } from 'vue'
import type { Options, FetchResult } from '../core/types'

export interface PaginationType {
  currentKey: string
  pageSizeKey: string
  totalKey: string
  totalPageKey: string
}

export interface PaginationExtendsOption {
  pagination?: Partial<PaginationType>
}

export interface PaginationOptions<T, P extends unknown[]> extends Options<T, P>, PaginationExtendsOption {}

export interface PaginationFetchResult<T, P extends unknown[]> extends FetchResult<T, P> {
  current: WritableComputedRef<number>
  pageSize: WritableComputedRef<number>
  total: ComputedRef<number>
  totalPage: ComputedRef<number>
  changeCurrent: (current: number) => void
  changePageSize: (pageSize: number) => void
  changePagination: (current: number, pageSize: number) => void
}
